package br.ufrn.btest.tests.unit;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Before;
import org.junit.Test;

import br.ufrn.btest.criterias.EachChoiceCriteria;

// TODO: improve tests
public class EachChoiceCriteriaTest {

	private HashMap<String, List<String>> characteristicsAndBlocks;
	private List<List<String>> parametersInputValues;
	
	@Before
	public void setUp() {
		parametersInputValues = new ArrayList<List<String>>();
		
		List<String> c1Blocks = new ArrayList<String>();
		c1Blocks.add("b1");
		c1Blocks.add("b2");
		c1Blocks.add("b3");

		List<String> c2Blocks = new ArrayList<String>();
		c2Blocks.add("b4");
		c2Blocks.add("b5");

		List<String> c3Blocks = new ArrayList<String>();
		c3Blocks.add("b6");
		c3Blocks.add("b7");
		c3Blocks.add("b8");
		c3Blocks.add("b9");

		characteristicsAndBlocks = new HashMap<String, List<String>>();
		characteristicsAndBlocks.put("c1", c1Blocks);
		characteristicsAndBlocks.put("c2", c2Blocks);
		characteristicsAndBlocks.put("c3", c3Blocks);
		
		parametersInputValues.add(c1Blocks);
		parametersInputValues.add(c2Blocks);
		parametersInputValues.add(c3Blocks);
	}
	
	@Test
	public void canGenerateEachChoice() {
		EachChoiceCriteria eachChoice = new EachChoiceCriteria(parametersInputValues);

		Set<String> expectedCombinations = new HashSet<String>();

		expectedCombinations.add("b1 & b4 & b6");
		expectedCombinations.add("b2 & b5 & b7");
		expectedCombinations.add("b3 & b5 & b8");
		expectedCombinations.add("b3 & b5 & b9");

		Set<String> combinations = eachChoice.getCombinationsStrings();

		assertEquals(expectedCombinations, combinations);
	}
	
}
